package com.lashou.chunshen.lashoutuangou.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.lashou.chunshen.lashoutuangou.R;
import com.lashou.chunshen.lashoutuangou.bean.BaseBean;
import com.lashou.chunshen.lashoutuangou.bean.HomeBanner;
import com.lashou.chunshen.lashoutuangou.tools.PicassoUtils;
import com.lashou.chunshen.lashoutuangou.widget.banner.BannerPagerAdapter;

/**
 * Created by Administrator on 2016/8/30.
 */
public class HomeBannerAdapter extends BannerPagerAdapter {
    private Context mContext;
    private BaseBean data;

    public HomeBannerAdapter(Context context, BaseBean data) {
        super(context, data);
        mContext = context;
        this.data = data;
    }

    /**
     * 只需要重写构造和这个方法即可
     * 在这里可以设置自己的View,使用自己的图片加载库
     */
    @Override
    public View setView(int position) {
        View v = LayoutInflater.from(mContext).inflate(R.layout.home_banner_item, null);
        ImageView iv = (ImageView) v.findViewById(R.id.iv_home_banner);
        iv.setScaleType(ImageView.ScaleType.FIT_XY);
        PicassoUtils.loadImageViewSize(mContext,((HomeBanner)data).getResults().getHeader_banner().get(position).getImg_big(),750,280,iv);
        return v;
    }
}